<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>StudentWorld</title>
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<?php
//naredi include, mora biti {}

require_once 'projekt_st/spletne/controller/ProfesorController.php';

$controller = new ProfesorController();



if(isset($_POST["brisi"])) {
    //echo "not";
    $profe = $controller->removeProfesorController($_POST['idProfesorja']);
}

else if(isset($_POST["dodaj"])) {
    if($_POST['ime'] != "" && $_POST['priimek'] != "" && $_POST['upIme'] != "" && $_POST['geslo'] != "" ) {    
    $model = new ProfesorController();
    //echo $_POST;
    //$data = array_pop($_POST);
    
    $oseba = $model->saveProfesor($_POST);
    //header( "Location: http://".$streznik."".$pot."/index.php?status=uspeh" );
 }   
}

$profesor = $controller->getAllProfesor();

include_once("seja.php"); 
{
    
?>

    <div id="wrapper">
    	<div id="header-wrapper">
        
    		<?php include_once("glava.php"); ?>
            
    	</div>
    	<!-- end #header -->
    	<div id="page">
    		<div id="page-bgtop">
    			<div id="page-bgbtm">
    				<div id="content">
    					<div class="post">    						
    						<div style="clear: both;">&nbsp;</div>
    						<div class="entry">
    							<h1>Dodaj profesorja</h1>
                                <p><form method="post" action="dodajProfesorja.php">
                                        <div>
                                        <table>
                                            <tr>
                                                <td>Ime profesorja:</td>
                                                <td><input type="text" name="ime" id="ime" value="" /></td>
                                            </tr>
                                            <tr>
                                                <td>Priimek profesorja:</td>
                                                <td><input type="text" name="priimek" id="priimek" value="" /></td>
                                            </tr>
                                            <tr>
                                                <td>Uporabniško ime profesorja:</td>
                                                <td><input type="text" name="upIme" id="upIme" value="" /></td>
                                            </tr>
                                            <tr>
                                                <td>Geslo profesorja:</td>
                                                <td><input type="password" name="geslo" id="geslo" value="" /></td>
                                            </tr>
                                        </table>
                                		<p><input type="submit" id="dodaj" name="dodaj" value="Dodaj" /></p>
                                        </div>
                                	</form></p>
                                    <?php

foreach($profesor as $prof):

?>
                                    <form method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
                                    
                                        <ul>
                                            <li><?php echo $prof->getIme()." ".$prof->getPriimek(); ?></li>
                                            <input type="hidden" name="idProfesorja" value="<?php echo $prof->getIdprofesor(); ?>" />
                                            <input type="submit" id="brisi" name="brisi" value="Brisi"/>
                                        </ul>
                                        
                                    </form>
                                    <?php

endforeach;

?>
    						</div>
    					</div>
    					
    					<div style="clear: both;">&nbsp;</div>
    				</div>
    				<!-- end #content -->
    				<div id="sidebar">
    					<ul>
    						
                            <?php

                                include_once('sidebar.php');

?>
    					</ul>
    				</div>
    				<!-- end #sidebar -->
    				<div style="clear: both;">&nbsp;</div>
    			</div>
    		</div>
    	</div>
    	<!-- end #page -->
    </div>
    <?php  include_once("noga.php"); } ?>
    <!-- end #footer -->
</body>
</html>
